declare var String: StringConstructor;
interface StringConstructor {
    new(value?: any): String;
    (value?: any): string;
    readonly prototype: String;
}
interface String {
    toString(): string;
}
//扩展类的原型
interface String {
	double():string;
}

String.prototype.double = function(){
	return this+'+'+this;
}
console.log('hello'.double());

//扩展类的实例
interface Window{
	myname:string
}
console.log(window.myname);
//export {} 没有导出就是全局扩展


class Form{
	username: Form.Item = "";
	password: Form.Item = "";
}
namespace Form{
	export class Item{}
}
let item:Form.Item = new Form.Item()

function greeting(name: string): string {
	return greeting.words+name;
}

namespace greeting {
	export let words = "Hello,";
}

console.log(greeting('jack'))

enum Color {
	red = 1,
	yellow = 2,
	blue = 3
}

namespace Color {
	export const green=4;
	export const purple=5;
}
console.log(Color.green)
import { createStore, Store } from 'redux';
type StoreExt = Store & {
    ext: string
}
let store: StoreExt = createStore(state => state);
store.ext = 'hello';
